//
//  LeaseListTableViewCell.m
//  PersonalProjects
//
//  Created by 王家骏 on 15/9/13.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "LeaseListTableViewCell.h"

@implementation LeaseListTableViewCell

- (void)setLeaseListCellModel:(LeaseListModel *)leaseListCellModel {
    _leaseListCellModel = leaseListCellModel;
    
    if ([leaseListCellModel.type integerValue] == 1) {
        _orderNumberLabel.text = leaseListCellModel.order_no;
        _typeLabel.text = @"Yopark租约";
    }else{
        _orderNumberLabel.text = leaseListCellModel.lease_no;
        _typeLabel.text = @"非Yopark租约";
    }
    _communityNameLabel.text = [NSString stringWithFormat:@"%@", leaseListCellModel.community_name];
    _roomConfigureLabel.text = [NSString stringWithFormat:@"%@ %@室%@厅%@卫 %@平米", leaseListCellModel.address, leaseListCellModel.bedroom_num, leaseListCellModel.room_num, leaseListCellModel.washroom_num, leaseListCellModel.square];
    _createTimeLabel.text = [NSString stringWithFormat:@"%@", leaseListCellModel.create_time];
    NSString *moneyString = [self outPutMoneyFormatter:leaseListCellModel.amount];
    if ([leaseListCellModel.seq integerValue] > 0) {
        _payAmountLabel.text = [NSString stringWithFormat:@"%@(第%@期)", moneyString, leaseListCellModel.seq];
    }else{
        _payAmountLabel.text = moneyString;
    }
    if ([leaseListCellModel.order_status integerValue] == 0) {
        _payButton.hidden = NO;                     //隐藏
        _payButton.userInteractionEnabled = YES;    //用户交互打开
        _payButton.backgroundColor = [Untility colorFromHexRGB:@"F2404D"];
        [_payButton setTitle:@"立即支付" forState:UIControlStateNormal];
    }else if([leaseListCellModel.order_status integerValue] == 1) {
        _payButton.hidden = YES;
    }
}

- (IBAction)pushToLeaseDetailsAction:(id)sender {
    
}

- (IBAction)pushToPaymentDetailsAction:(id)sender {
    
}

- (void)awakeFromNib {
    // Initialization code

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (NSString *)outPutMoneyFormatter:(NSString *)intPutString {
    intPutString = [NSString stringWithFormat:@"%@", intPutString];
    double doublePutString = [intPutString doubleValue];
    NSString *resultString = [NSString stringWithFormat:@"￥%.2f", doublePutString];
    return resultString;
}

@end
